package com.huifer.wgx.model;

import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * <p>Title : ResultLineAttrEntity </p>
 * <p>Description : </p>
 *
 * @author huifer
 * @date 2019-03-20
 */
@Entity
@Table(name = "t_result_line_attr", schema = "at15", catalog = "")
public class ResultLineAttrEntity {

    private Long otherLineAttrId;
    private String otherLineStartPic;
    private String otherLineEndPic;
    private Long interiorLineId;
    private Long personnelId;
    private Long workId;
    private InteriorPointEntity tInteriorPointByInteriorLineId;
    private PersonnelEntity tPersonnelByPersonnelId;
    private WorkEntity tWorkByWorkId;

    @Id
    @Column(name = "other_line_attr_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getOtherLineAttrId() {
        return otherLineAttrId;
    }

    public void setOtherLineAttrId(Long otherLineAttrId) {
        this.otherLineAttrId = otherLineAttrId;
    }

    @Basic
    @Column(name = "other_line_start_pic")
    public String getOtherLineStartPic() {
        return otherLineStartPic;
    }

    public void setOtherLineStartPic(String otherLineStartPic) {
        this.otherLineStartPic = otherLineStartPic;
    }

    @Basic
    @Column(name = "other_line_end_pic")
    public String getOtherLineEndPic() {
        return otherLineEndPic;
    }

    public void setOtherLineEndPic(String otherLineEndPic) {
        this.otherLineEndPic = otherLineEndPic;
    }

    @Basic
    @Column(name = "interior_line_id")
    public Long getInteriorLineId() {
        return interiorLineId;
    }

    public void setInteriorLineId(Long interiorLineId) {
        this.interiorLineId = interiorLineId;
    }

    @Basic
    @Column(name = "personnel_id")
    public Long getPersonnelId() {
        return personnelId;
    }

    public void setPersonnelId(Long personnelId) {
        this.personnelId = personnelId;
    }

    @Basic
    @Column(name = "work_id")
    public Long getWorkId() {
        return workId;
    }

    public void setWorkId(Long workId) {
        this.workId = workId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ResultLineAttrEntity that = (ResultLineAttrEntity) o;
        return Objects.equals(otherLineAttrId, that.otherLineAttrId) &&
                Objects.equals(otherLineStartPic, that.otherLineStartPic) &&
                Objects.equals(otherLineEndPic, that.otherLineEndPic) &&
                Objects.equals(interiorLineId, that.interiorLineId) &&
                Objects.equals(personnelId, that.personnelId) &&
                Objects.equals(workId, that.workId);
    }

    @Override
    public int hashCode() {
        return Objects
                .hash(otherLineAttrId, otherLineStartPic, otherLineEndPic, interiorLineId,
                        personnelId,
                        workId);
    }

    @ManyToOne
    @JoinColumn(name = "interior_line_id", referencedColumnName = "interior_point_id",insertable = false,updatable = false)
    public InteriorPointEntity gettInteriorPointByInteriorLineId() {
        return tInteriorPointByInteriorLineId;
    }

    public void settInteriorPointByInteriorLineId(
            InteriorPointEntity tInteriorPointByInteriorLineId) {
        this.tInteriorPointByInteriorLineId = tInteriorPointByInteriorLineId;
    }

    @ManyToOne
    @JoinColumn(name = "personnel_id", referencedColumnName = "personnel_id",insertable = false,updatable = false)
    public PersonnelEntity gettPersonnelByPersonnelId() {
        return tPersonnelByPersonnelId;
    }

    public void settPersonnelByPersonnelId(PersonnelEntity tPersonnelByPersonnelId) {
        this.tPersonnelByPersonnelId = tPersonnelByPersonnelId;
    }

    @ManyToOne
    @JoinColumn(name = "work_id", referencedColumnName = "work_id",insertable = false,updatable = false)
    public WorkEntity gettWorkByWorkId() {
        return tWorkByWorkId;
    }

    public void settWorkByWorkId(WorkEntity tWorkByWorkId) {
        this.tWorkByWorkId = tWorkByWorkId;
    }
}
